import { defineStore } from 'pinia'

export const usePropertyStore = defineStore('property', {
  state: () => ({
    gold: 0,
    soul: 0,
    box1: 0,
    box2: 0,
    extra1: 0,
    extra2: 0,
    extra3: 0,
    charactor_data: [],
  }),
  actions: {
    setGold(value) { this.gold = Number(value) || 0 },
    setSoul(value) { this.soul = Number(value) || 0 },
    setBox1(value) { this.box1 = Number(value) || 0 },
    setBox2(value) { this.box2 = Number(value) || 0 },
    setExtra1(value) { this.extra1 = Number(value) || 0 },
    setExtra2(value) { this.extra2 = Number(value) || 0 },
    setExtra3(value) { this.extra3 = Number(value) || 0 },
    setCharactorData(data) { this.charactor_data = Array.isArray(data) ? data : [] },
    reset() {
      this.gold = 0
      this.soul = 0
      this.box1 = 0
      this.box2 = 0
      this.extra1 = 0
      this.extra2 = 0
      this.extra3 = 0
      this.charactor_data = []
    }
  }
})


